/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package snAnalysis;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author THAI
 */
public class GenerateWaveCode {

    private String waveS;
    private String getBlogRequestPath;

    public GenerateWaveCode(boolean simple) {
        if (simple != true) {
            this.waveS = "";
        } else {
            this.waveS = "";
            SNALib bfl = new SNALib();
            if (bfl.getOSName().compareToIgnoreCase("windows") != 0) {
                this.getBlogRequestPath = Configuration.getValue("windowsPath", "C:\\Windows\\Temp");
            } else {
                this.getBlogRequestPath = Configuration.getValue("linuxPath", "/root/");
            }
        }
    }

    public void del(){
        this.waveS="";
    }

    public String getWaveString() {
        String temp = this.waveS.substring(0, this.waveS.length()-1);

        return temp + ")";
    }

    public String sendNodeWave(String IP, String blogID) {
        String waveCode = "@#`" + IP + "'$$`" + IP + "'.Fa=1;1;`" + blogID + "'.Fa?getToDB";

        return waveCode;
    }

    public void initWaveS(String blogID, String destIP, String localIP) {
        if (destIP.compareTo(localIP) == 0) {
            this.waveS = "CR(@#`" + blogID + "'.";
        }
        else {
            this.waveS = "CR(@#`" + blogID + "'$$`" + destIP + "'.";
        }
    }

    public void appendWaveS(String blogID, String blogIP, String friendIP) {
        if (blogIP.compareTo(friendIP) == 0) {
            this.waveS += "`1'#`" + blogID + "',";
        } else {
            this.waveS += "`1'#`" + blogID + "'$$`" + friendIP + "',";
        }
    }
}

